#include "statusmessagewidget.h"
#include <QPainter> // Ensure QPainter is included

StatusMessageWidget::StatusMessageWidget(QWidget *parent)
    : QWidget(parent)
{
    setAttribute(Qt::WA_TranslucentBackground); // Make background transparent
    setAutoFillBackground(false); // Don't auto-fill background
    setAttribute(Qt::WA_NoSystemBackground); // Prevent system from drawing background
    setMinimumSize(200, 20); // Set minimum size
}

void StatusMessageWidget::setText(const QString &text)
{
    m_text = text;
    update(); // Update drawing when text changes
}

void StatusMessageWidget::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event);
    QPainter painter(this);
    painter.setRenderHint(QPainter::Antialiasing);

    // No background fill here, let it be transparent

    painter.setPen(Qt::black); // Set text color to black
    painter.drawText(rect(), Qt::AlignVCenter | Qt::AlignLeft, m_text);
}

QSize StatusMessageWidget::sizeHint() const
{
    return QSize(200, 20); // Provide a suitable size hint
}

QSize StatusMessageWidget::minimumSizeHint() const
{
    return QSize(200, 20); // Provide a suitable minimum size hint
}